Imports Microsoft.VisualBasic
Imports System.Data.Common

Public Class MySqlCommand
    Inherits DbCommand

    Private ReadOnly _cmd As MySql.Data.MySqlClient.MySqlCommand

    Sub New()

        Me._cmd = New MySql.Data.MySqlClient.MySqlCommand

    End Sub

    Sub New(ByVal cmd As MySql.Data.MySqlClient.MySqlCommand)

        Me._cmd = cmd

    End Sub

    Public Overrides Sub Cancel()

        Me._cmd.Cancel()

    End Sub

    Public Overrides Property CommandText() As String
        Get
            Return Me._cmd.CommandText
        End Get
        Set(ByVal value As String)
            Me._cmd.CommandText = value
        End Set
    End Property

    Public Overrides Property CommandTimeout() As Integer
        Get
            Return Me._cmd.CommandTimeout
        End Get
        Set(ByVal value As Integer)
            Me._cmd.CommandTimeout = value
        End Set
    End Property

    Public Overrides Property CommandType() As System.Data.CommandType
        Get
            Return Me._cmd.CommandType
        End Get
        Set(ByVal value As System.Data.CommandType)
            Me._cmd.CommandType = value
        End Set
    End Property

    Protected Overrides Function CreateDbParameter() As System.Data.Common.DbParameter

        Return New MySqlParameter()

    End Function

    Protected Overrides Property DbConnection() As System.Data.Common.DbConnection
        Get
            Return New MySqlConnection(Me._cmd.Connection)
        End Get
        Set(ByVal value As System.Data.Common.DbConnection)
            Me._cmd.Connection = CType(value, MySqlConnection)._conn
        End Set
    End Property

    Protected Overrides ReadOnly Property DbParameterCollection() As System.Data.Common.DbParameterCollection
        Get
            Return New MySqlParameterCollection(Me._cmd.Parameters)
        End Get
    End Property

    Protected Overrides Property DbTransaction() As System.Data.Common.DbTransaction
        Get
            Return New MySqlTransaction(Me._cmd.Transaction)
        End Get
        Set(ByVal value As System.Data.Common.DbTransaction)
            Me._cmd.Transaction = CType(value, MySqlTransaction)._tran
        End Set
    End Property

    ''' <summary>
    ''' not implemented
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overrides Property DesignTimeVisible() As Boolean
        Get

        End Get
        Set(ByVal value As Boolean)

        End Set
    End Property

    Protected Overrides Function ExecuteDbDataReader(ByVal behavior As System.Data.CommandBehavior) As System.Data.Common.DbDataReader

        Return New MySqlDataReader(Me._cmd.ExecuteReader(behavior))

    End Function

    Public Overrides Function ExecuteNonQuery() As Integer

        Return Me._cmd.ExecuteNonQuery()

    End Function

    Public Overrides Function ExecuteScalar() As Object

        Return Me._cmd.ExecuteScalar()

    End Function

    Public Overrides Sub Prepare()

        Me._cmd.Prepare()

    End Sub

    Public Overrides Property UpdatedRowSource() As System.Data.UpdateRowSource
        Get
            Return Me._cmd.UpdatedRowSource
        End Get
        Set(ByVal value As System.Data.UpdateRowSource)
            Me._cmd.UpdatedRowSource = value
        End Set
    End Property
End Class
